package com.wipz.eoa.iphone.officesupplies;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.wipz.eoa.iphone.BaseAction;

public class SuppliesCategoryAction extends BaseAction {
	private ISuppliesCategoryService suppliesCategoryService;
	private List<Object> list;
	private Map<String,Object> view;

	public Map<String, Object> getView() {
		return view;
	}

	public void setView(Map<String, Object> view) {
		this.view = view;
	}

	public List<Object> getList() {
		return list;
	}

	public void setList(List<Object> list) {
		this.list = list;
	}

	public void setSuppliesCategoryService(
			ISuppliesCategoryService suppliesCategoryService) {
		this.suppliesCategoryService = suppliesCategoryService;
	} 
	
	public String list(){
		Map params=new HashMap();
		String commitCode = "040";
		params.put("COMMITERCODE", commitCode);
		params.put("CATEGORYCODE", getRequest().getParameter("CATEGORYCODE"));
		params.put("CATEGORYNAME", getRequest().getParameter("CATEGORYNAME"));
		params.put("ISCONSUMABLE",getRequest().getParameter("ISCONSUMABLE"));
		params.put("APPLYDATE", getRequest().getParameter("APPLYDATE"));
		String pageNo = (String)getRequest().getParameter("pageNo");
		String pageSize = (String)getRequest().getParameter("pageSize");
		list=suppliesCategoryService.queryList("suppliesCategory.querylist", params);
		return SUCCESS;
	}
	public String view(){
		String id=getRequest().getParameter("id");
		String userCode="040";
		if(StringUtils.isNotEmpty(id)){
			Map params = new HashMap();
			params.put("ID",id);
			params.put("COMMITERCODE", userCode);
			view =(Map)suppliesCategoryService.queryOne("suppliesCategory.queryByID", params);
		}
		return SUCCESS;
	}
	public String insert(){
		return SUCCESS;
	}
	public String delete(){
		String userCode="";
		String id=getRequest().getParameter("id");
		if(StringUtils.isNotEmpty(id)){
			Map<String,Object> params=new HashMap<String,Object>();
			params.put("ID", id);
			params.put("COMMITERCODE",userCode);
			suppliesCategoryService.deleteByIdAndUserCode("suppliesCategory.delete",params);
		}
		return SUCCESS;
	}
	private String update(){
		return SUCCESS;
	}
}
